Skip to content

Conversation

@floor-licker
Copy link

This PR introduces a basic s–t flow setup for undirected SimpleGraphs and proves the standard weak-duality
inequality: for any feasible flow f and any s–t cut S, value f ≤ cutCapacity S.

This is a small, self-contained lemma I extracted while working on larger graph-theoretic formalizations, in particular, results that will ultimately rely on a full max-flow/min-cut theorem. The full MFMC equality/existence statement is not included here. This is the weak-duality direction (∀ f S, value f ≤ cutCapacity S).

@github-actions github-actions bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-combinatorics Combinatorics labels Jan 16, 2026
@github-actions
Copy link

github-actions bot commented Jan 16, 2026

PR summary 3de2350c1f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Combinatorics.SimpleGraph.Connectivity.MaxFlowMinCut (new file) 527

Declarations diff

+ Flow
+ cutCapacity
+ cutValue
+ cutValue_le_cutCapacity
+ netOut
+ netOut_def
+ value
+ value_def
+ value_eq_cutValue
+ value_le_cutCapacity

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions
Copy link

github-actions bot commented Jan 16, 2026

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@floor-licker floor-licker changed the title feat(SimpleGraph): add max-flow/min-cut weak duality feat(SimpleGraph): add max-flow/min-cut weak duality Jan 16, 2026
Comment on lines 37 to 38
structure Flow (G : SimpleGraph V) (c : Sym2 V → ℕ) (s t : V) where
val : V → V → ℤ
Copy link
Collaborator

@SnirBroshi SnirBroshi Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow non-integral flows we should define flows on more general types.
Perhaps {α : Type*} [AddGroup α] [LE α] for the definition, and most lemmas would require [LinearOrder α]? I'm not sure what's the best choice here.
The capacities can have the same type as the values, and capacity will enforce they are non-negative.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that an α-valued Flow might be nicer API, but for now I would like to keep ℤ/ℕ because the next step is strong MFMC (and Menger), where integrality/termination arguments are way simpler. Happy to follow up with a separate PR generalizing the definition + weak duality once the core theorem lands. I think at this point generalizing would unnecessarily increase the overhead of mechanizing a lot of the core results in graph theory, but let me know what you think.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm that depends. Do you prefer splitting because it'll be easier to review, or because you did not prove the general case and prefer to leave generalizing as a TODO? Both are good reasons to not generalize now, but "integrality/termination arguments are way simpler" confuses me.
If it's neither of these (e.g. you already proved the general case but want to PR the special case first and then replace it entirely) then I don't see a reason to do this.

Either way I think having both / complicates things (adds casts and makes this not a special case of the general case), wdyt about using integer capacities? Non-negativity is already enforced.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sorry, my phrasing was sloppy. The reason I’m not generalizing to α in this PR is that I haven’t proved the α-valued development yet so it would basically be leaving a design-heavy TODO, and my next planned step is strong MFMC via an augmenting-path/Ford–Fulkerson style proof, where working integrally makes the termination/integrality story much cleaner, and also lines up with the Menger corollary later. Agreed about the ℤ/ℕ mix: I’ve updated the code to use integer capacities (c : Sym2 V -> ℤ). Thanks for the suggestion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the problem is strong MFMC, can you generalize the Flow stuff here, and just in your proof of strong MFMC take in a Flow ℤ?

btw wouldn't a proof using LP duality work? I imagine it's much cleaner since we don't need any algorithmic proof + termination, and it should work for the general case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I’ve generalized the definitions/weak duality so Flow takes values in α and capacities are c : Sym2 V -> α (so no casts and this covers non-integral flows). You're right that can prove strong MFMC by specializing to α := ℤ. Re LP duality, I just saw that Mathlib/Analysis/Convex/Cone/Basic.lean discusses Farkas/conic duality and explicitly lists LP duality as a TODO, i.e, it seems like the main underlying infrastructure would be lacking there. But if you think that avenue would lead to overall cleaner code I'm happy to do it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-combinatorics Combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants